package com.ssm.tag;

import javax.servlet.ServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

/**
 * SSM定义标签用于覆盖页面继承中的占位部分
 * @author WWT<245108903@qq.com>
 * @version 2016/1/20
 * */
public class OverWriteTag extends BodyTagSupport {

	private static final long serialVersionUID = 1L;
	private static final String PREFIX = "SSMTAG_";
	
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	@Override
	public int doEndTag() throws JspException {
		// TODO Auto-generated method stub
		ServletRequest request=pageContext.getRequest();
		request.setAttribute(PREFIX+name,getBodyContent()==null?"":getBodyContent().getString().trim());

		return super.doEndTag();
	}

	
	
}
